package com.shanks.home.util;

import android.content.Context;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.telephony.TelephonyManager;

/**
 * @author Shanks
 * @time 2014.02.24
 */
public class DeviceUtil {
	
	private static final String TAG = DeviceUtil.class.getSimpleName();
	
	private static Context context;
	
	/**
	 * init 
	 */
	public static void init(Context c) {
		context = c;
	}
	
	/**
	 * get mac address
	 */
	public static String getMacAddress() {
		WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
		WifiInfo wifiInfo = wifiManager.getConnectionInfo();
		LogUtil.i(TAG, "mac address:" + wifiInfo.getMacAddress());
		return wifiInfo.getMacAddress();
	}
	
	/**
	 * get device id
	 */
	public static String getDeviceId() {
		TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
		LogUtil.i(TAG, "device id:" + telephonyManager.getDeviceId());
		return telephonyManager.getDeviceId();
	}
}